import React from 'react';

import Login from '../Pages/login'
import Index from '../Pages/index'

import HomePage from '../Pages/index/homePage'
import TransMamage from '../Pages/index/transManage'
import DevelopManage from '../Pages/index/developManage'
import PeoductSubs from '../Pages/index/productSubs'
import LogManage from '../Pages/index/logmanage'

//DevelopManage  submenu
import ApiText from '../Pages/index/develop/apitest'
import ApiMenu from '../Pages/index/develop/apimenu'
import ApiUse from '../Pages/index/develop/apiuse'
import AccessDesc from '../Pages/index/develop/apiuse/accessdesc'
import SaftyDesc from '../Pages/index/develop/apiuse/saftdesc'
import CallDesc from '../Pages/index/develop/apiuse/calldesc'
import TestDesc from '../Pages/index/develop/apiuse/testdesc'

// TransMamage submenu
import ClientMatain from '../Pages/index/transManage/clientMatain'
import ProductFeeDetail from '../Pages/index/transManage/ProductFeeDetail'
import UserFeeDetail from '../Pages/index/transManage/userFeeDetail'

import {
    Route,
} from 'react-router-dom'



const routes = [
  { path: '/',
    component: Login,
    exact:true,
  },
  { path: '/index',
    component: Index,
    exact:false,
    routes: [
        { path: '/index/HomePage',
          component: HomePage,
          name:'首页'
        },
        { path: '/index/transManage/',
          component: TransMamage,
          name:'账单管理',
            routes:[
                {
                    path: '/index/transManage/clientMatain',
                    name:'客户维护',
                    component: ClientMatain,
                },
                {
                    path: '/index/transManage/userFeeDetail',
                    name:'用户计费详情',
                    component: UserFeeDetail,
                },
                {
                    path: '/index/transManage/productFeeDetail',
                    name:'产品计费详情',
                    component: ProductFeeDetail,
                }
            ]
        },
        { path: '/index/developManage',
          component: DevelopManage,
          name:'开发管理',
          routes:[
              {
                  path: '/index/developManage/APITest',
                  name:'API测试',
                  component: ApiText,
                  exact:true
              },
              {
                  path: '/index/developManage/apiUse',
                  component: ApiUse,
                  name:'API使用说明',
                  routes:[
                      {path: '/index/developManage/apiUse/accessDesc',
                      component: AccessDesc,
                      name:'API接入说明'
                      },
                      {path: '/index/developManage/apiUse/saftyDesc',
                       component: SaftyDesc,
                          name:'API安全说明'
                      },
                      {path: '/index/developManage/apiUse/callDesc',
                          component: CallDesc,
                          name:'API调用说明'},
                      {path: '/index/developManage/apiUse/testDesc',
                          component: TestDesc,
                          name:'API测试说明'}
                  ]
              },
              {
                  path: '/index/developManage/APIMenu',
                  name:'API总目录',
                  exact:true,
                  component: ApiMenu,
              }
          ]
        },
        { path: '/index/productSubs',
            component: PeoductSubs,
            name:'产品订购'
        },
        { path: '/index/logmanage',
            component: LogManage,
            name:'日志管理'
        },
    ]
  },
  {
    component: Login
  }
]



const RouteWithSubRoutes = (route) => (
   <Route path={route.path}  children={route.children||false} exact={route.exact||false}  render={props => (
    // pass the sub-routes down to keep nesting/index
    <route.component {...props} routes={route.routes}/>
  )}/>)




export  { RouteWithSubRoutes , routes }
